
export default class History {
    constructor(router){
        this.router = router
         // 有一个数据来保存路径的变化
        // 当前没有匹配到记录

        this.current =createRoute(null,{path:'/'})
    }
    transitionTo(path,cb){
        // console.log(path,cb)
       let route =  this.router.match(path)
       createRoute(route,{path})
       console.log(this.current)
       cb&&cb();
    }
}

function createRoute(record,location) {
    return {
        ...location,
        matched:[]
    }
}